package yunquan.wang.modules.base.entity;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import yunquan.wang.base.domain.IdEntity;

@Entity
@Table(name = "BASE_AUTHORITY_TYPE")
public class AuthorityType extends IdEntity {
	/**
	 * 
	 */
	private static final long serialVersionUID = -4773387198612691595L;

	@Column(name = "NAME")
	@NotNull
	private String name;// 权限类型.如系统权限，用户权限，顾客权限等等
	@Column(name = "CNNAME")
	private String cnname;
	@ManyToOne
	@JoinColumn(name = "PARENT_ID")
	private AuthorityType parent;
	@OneToMany(cascade = CascadeType.ALL, mappedBy = "authorityType")
	private Set<Authority> authoritys = new HashSet<Authority>(0);// 权限类型下的权限列表
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "parent")
	private Set<AuthorityType> childs=new HashSet<AuthorityType>(0);
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getCnname() {
		return cnname;
	}
	public void setCnname(String cnname) {
		this.cnname = cnname;
	}
	public AuthorityType getParent() {
		return parent;
	}
	public void setParent(AuthorityType parent) {
		this.parent = parent;
	}
	public Set<Authority> getAuthoritys() {
		return authoritys;
	}
	public void setAuthoritys(Set<Authority> authoritys) {
		this.authoritys = authoritys;
	}
	public Set<AuthorityType> getChilds() {
		return childs;
	}
	public void setChilds(Set<AuthorityType> childs) {
		this.childs = childs;
	}
	 
 
}
